﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using Microsoft.Win32;
using PSE.Deployment.SetupBase.Configuration.Enums;

namespace PSE.Deployment.SetupBase.Configuration
{
    [Serializable]
    public class RegistryValue
    {
        private string _value;

        [XmlAttribute()]
        public string Name { get; set; }

        [XmlAttribute()]
        public string Description { get; set; }

        [XmlAttribute()]
        public string Value
        {
            get
            {
                return _value;
            }
            set
            {
                if (!string.IsNullOrEmpty(_value) && value != _value)
                    HasChanges = true;

                if (value.ToLower() == "sinawin")
                    _value = value;

                _value = value;
            }
        }

        [XmlAttribute()]
        public bool HasChanges { get; set; }

        [XmlAttribute()]
        public string XPath { get; set; }

        [XmlAttribute()]
        public RegistryValueKind RegistryValueKind { get; set; }

        [XmlAttribute()]
        public XmlTagType Type { get; set; }

        [XmlAttribute()]
        public bool IsEncrypted { get; set; }

        [XmlAttribute()]
        public CryptographyAlgorithm EncryptionAlgorithm { get; set; }

        [XmlAttribute()]
        public string AlgorithmPublicKey { get; set; }

        [XmlAttribute()]
        public bool IsRequired { get; set; }

        [XmlAttribute()]
        public bool IsVisible { get; set; }
    }
}
